'use strict';

module.exports = {
  async up (queryInterface, Sequelize) {
    /**
     * Add altering commands here.
     *
     * Example:
     * await queryInterface.createTable('users', { id: Sequelize.INTEGER });
     */
     const { INTEGER, DATE, STRING } = Sequelize;
      await queryInterface.createTable('captain', {
        id: { type: INTEGER, primaryKey: true, autoIncrement: true },
        name: STRING(30),
        skillLevel:INTEGER,
        ship_id:{type:INTEGER,
        references:{
          model:{
            tableName:'ship'
          },
           key:'id',
        }
        }
      });
  },

  async down (queryInterface, Sequelize) {
    /**
     * Add reverting commands here.
     *
     * Example:
     * await queryInterface.dropTable('users');
     */
     await queryInterface.dropTable('captain');
  }
};
